package joapp

import (
	"gitee.com/jolib/jokode"
	"gitee.com/jolib/jokode/jofile"
	"os"
)

func GetProcessName() string {
	var exePath string

	if p, err := os.Executable(); err != nil {
		exePath = os.Args[0]
		jokode.Warnf("try get executable fail, will use arg[0]: '%s', error info: %v", exePath, err)
	} else {
		exePath = p
	}

	_, fileName, _ := jofile.SplitFilePath(exePath)

	return fileName
}
